home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / lpc / lpctest.c < prev    next >
C/C++ Source or Header  |  2000-05-18  |  586b  |  33 lines

  1. #include <stdio.h>
  2. #include "lpc.h"
  3.  
  4. /*#define ENCODE/**/
  5. /*#define DECODE/**/
  6.  
  7. main(argc, argv)
  8.   int argc;
  9.   char **argv;
  10. {
  11.   int nbytes;
  12.   unsigned char buf[160];
  13.   lpcparams_t params;
  14.  
  15.   lpcstate_t state;
  16.  
  17. fprintf(stderr, "S = %d\n", sizeof params);
  18.   lpc_init(&state);
  19. #ifndef DECODE
  20.   while ((nbytes = read(0, buf, sizeof(buf))) > 0) {
  21.     lpc_analyze(buf, ¶ms);
  22. #else
  23.   while ((nbytes = read(0, ¶ms, sizeof(params))) > 0) {
  24. #endif
  25. #ifdef ENCODE
  26.     write(1, ¶ms, sizeof params);
  27. #else
  28.     lpc_synthesize(buf, ¶ms, &state);
  29.     write(1, buf, nbytes);
  30. #endif
  31.   }
  32. }
  33.